package com.xlh.enums.course;

import com.google.common.collect.Lists;
import com.xlh.security.UserInfoHolder;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.List;

/**
 * 课程导航枚举
 * <p>
 * Created by lx on 2019/4/25.
 */
@Getter
@AllArgsConstructor
public enum CourseNavigationEnum {

    DETAIL("详情"),
    REVIEW("批阅"),
    COMMUNICATE("交流"),
    TEST("考试"),
    STATISTICS("统计"),
    MANAGEMENT("管理"),
    ACHIEVEMENT("成绩");

    private String message;

    public static List<CourseNavigationEnum> getUserNavigationEnum(UserInfoHolder userInfoHolder) {
        if (userInfoHolder.isTeacher()) {
            return Lists.newArrayList(CourseNavigationEnum.DETAIL, CourseNavigationEnum.REVIEW,
                    CourseNavigationEnum.COMMUNICATE, CourseNavigationEnum.TEST, CourseNavigationEnum.STATISTICS,
                    CourseNavigationEnum.MANAGEMENT);
        }
        if (userInfoHolder.isStudent()) {
            return Lists.newArrayList(CourseNavigationEnum.DETAIL, CourseNavigationEnum.ACHIEVEMENT,
                    CourseNavigationEnum.COMMUNICATE, CourseNavigationEnum.TEST);
        }
        return null;
    }

}
